# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - !strip option, stripped binary fails under ARM

pkgname=gendesk
pkgver=1.0.10
pkgrel=1
pkgdesc='Utility for generating desktop files by specifying a minimum of information'
arch=(x86_64)
url='https://gendesk.roboticoverlords.org/'
license=(MIT)
makedepends=(go)
options=(!strip !lto)
validpgpkeys=(8A9BC5819C54FEB3DC2A9B48C32217F6F13FF192)
source=('https://roboticoverlords.org/images/gendesk.png'
        "https://roboticoverlords.org/$pkgname/$pkgname-$pkgver.tar.xz"{,.asc})
b2sums=('4676b13f6154f511497f5264310f861af2fab798d9fc5d9e39ae2379da3fd24317f777ec437d57a58aef344158cfe77bdce9f32bc17eeeb7126e0954af417b35'
        '7c90846db6a053b2b5fe2acafaa3974e27dc1dea5001dc5e2b62a3ebd4626e5fd9d3508a1202aa99c8ad063e71d4970cf8328deb3855863198bcfd25d8c7dbc6'
        'SKIP')

build() {
  cd $pkgname-$pkgver
  go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -linkmode=external -extldflags '$LDFLAGS'"
}

package() {
  cd $pkgname-$pkgver
  install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm644 $pkgname.1.gz "$pkgdir/usr/share/man/man1/$pkgname.1.gz"
  install -Dm644 "$srcdir/gendesk.png" "$pkgdir/usr/share/pixmaps/gendesk.png"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
